package com.mangosteen.app.dao;

import com.mangosteen.app.dao.mapper.UserInfoMapper;
import com.mangosteen.app.model.dao.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class UserDaoImpl implements UserDao {
    private final UserInfoMapper userInfoMapper;

    @Autowired //构造器注入
    public UserDaoImpl(UserInfoMapper userInfoMapper) {
        this.userInfoMapper = userInfoMapper;
    }

    @Override
    public UserInfo getUserInfoByUserId(Long id) {
        return userInfoMapper.getUserInfoByUserId(id);
    }

    @Override
    public UserInfo getUserInfoByUsername(String username) {
        return userInfoMapper.getUserInfoByUsername(username);
    }

    @Override
    public void createUser(com.mangosteen.app.model.bo.UserInfo userInfo) {
          System.out.println(userInfo);
        System.out.println("1234");
          userInfoMapper.createNewUser(userInfo);
    }
}
